package net.obviam.starassault.model;

import net.obviam.starassault.model.Block.BlockType;
import net.obviam.starassault.view.StaticTextures;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;

public class Bullet {

	private Vector2 position = new Vector2();
	private Rectangle bounds;
	private BulletType type;
	public boolean bulletLife;
	public int bulletTimer;
	public Vector2 velocity = new Vector2();
	public enum BulletType{
		Fast, Slow
	}
	
	public Bullet(float x, float y){
		this.position.x = x;
		this.position.y = y;
		bulletTimer = 1000;
		bounds = new Rectangle(position.x, position.y, 16, 16);
	}
	
	public Vector2 getPosition() {
		return position;
	}

	public Vector2 getVelocity() {
		return velocity;
	}
	
	public boolean isBulletType(BulletType type){
		if(this.type == type){
			return true;
		}
		return false;
	}
	
	public Rectangle getBounds() {
		return bounds;
	}

	public void setBounds(float x, float y, float h, float w){
		bounds.x = x;
		bounds.y = y;
		bounds.height = h;
		bounds.width = w;
	}

	public boolean getBulletLife(){
		if(bulletTimer < 0){
			return false;
		}
		return true;
	}

	
	public void update(float ppuX, float ppuY){
		this.position.add(0.5f, 0);
		bulletTimer -= Gdx.graphics.getDeltaTime()*1000;
		setBounds(this.position.x* ppuX, this.position.y * ppuY, 0.5f*ppuY, 0.5f*ppuX);
	}

}
